#include "Configuration.h"

#include "CppJieba.hpp"
#include <string>
#include <map>

using WordSegmentation = CppJieba;

using std::string;
using std::map;

class WebPage
{
    friend bool operator== (const WebPage &lhs, const WebPage &rhs);
    friend bool operator< (const WebPage & lhs, const WebPage &rhs);
public:
    WebPage(Configuration* config, WordSegmentation &jieba, 
            int &docId, const string &docTitle,
            const string &docUrl, const string&docContent);

    void   reSetDocId(int docId);//重新修改每个文章id
    void   getSimhashvalue();//获取hash值

    int getDocId();
    string getDoc();
    string getTitle();
    string getUrl();
    string getContent();
    map<string, int> & getWordsMap();//返回词频结构体map
private:
    void processDoc(const string& doc, Configuration* config, WordSegmentation& jieba);//词频建立
private:
    string _doc;//全文
    int _docId;
    string _docTitle;
    string _docUrl;
    string _docContent;
    string _docSummmary;
    map<string, int> _wordsMap;
    uint64_t _simhashValue;
};
